
package lanqiao;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Q0505 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
		String[] words = br.readLine().split(" ");
		int n = Integer.parseInt(words[0]);
		int[][] d = new int[n][n];

		for (int i = 0; i < n; i++) {
			words = br.readLine().split(" ");
			for (int j = 0; j <= i; j++) {
				d[i][j] = Integer.parseInt(words[j]);
			}
		}

		int[][] maxStep = new int[n][n];

		for (int i = 0; i < maxStep.length; i++) {
			for (int j = 0; j <= i; j++) {
				maxStep[i][j] = d[i][j];
				if (i > 0) {
					int tmp = 0;
					if (j - 1 >= 0) {
						tmp = Math.max(tmp, maxStep[i - 1][j - 1]);
					}
					if (j <= i - 1) {
						tmp = Math.max(tmp, maxStep[i - 1][j]);
					}
					maxStep[i][j] += tmp;
				}
			}
		}
		if (n % 2 == 1) {
			wr.write(maxStep[n - 1][n / 2] + "");
		} else {
			wr.write(Math.max(maxStep[n - 1][n / 2], maxStep[n - 1][(n - 1) / 2]) + "");
		}

		wr.flush();
	}
}
